package com.cn.yang.controller;

import com.alibaba.fastjson.JSONObject;
import com.cn.yang.bean.Group;
import com.cn.yang.service.GroupService;
import com.cn.yang.service.PersonnelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/group")
public class GroupController {
    @Autowired
    GroupService groupService;
    @Autowired
    PersonnelService personnelService;
    @RequestMapping("/groupAdd")
    public JSONObject groupAdd(@RequestBody List<Group> list){
//        int result = groupService.groupAdd(group);
        personnelService.updateGroup(list);
        System.out.printf(list.get(0).getGroupName());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("result",1);
        return jsonObject;
    }
}
